﻿//-----------------------------------------------------------------------
// <copyright file="ArgsExprType.cs" company="tuliprules.org">
//     Copyright (c) 2011 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the ArgsExprType class.</summary>
//-----------------------------------------------------------------------
namespace Tulip.Rules.Models.Rif.Prd
{
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents the args-Expr type.
    /// </summary>
    [System.Serializable]
    [DesignerCategory(@"code")]
    [XmlType(TypeName = "args-Expr.type", Namespace = "http://www.w3.org/2007/rif#")]
    public class ArgsExprType : IRifPrdElement
    {
        /// <summary>
        /// The items field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private List<object> itemsField;

        /// <summary>
        /// The ordered field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private string orderedField;

        /// <summary>
        /// Initializes a new instance of the <see cref="ArgsExprType"/> class. 
        /// </summary>
        public ArgsExprType()
        {
            this.itemsField = new List<object>();
            this.orderedField = "yes";
        }

        /// <summary>
        /// Gets or sets a list of items roles, with ordered="yes" attribute, 
        /// containing n TERMs
        /// </summary>
        [XmlElement("Const", typeof(Const), Order = 0)]
        [XmlElement("Var", typeof(Var), Order = 0)]
        [XmlElement("External", typeof(ExternalTermType), Order = 0)]
        [XmlElement("List", typeof(List), Order = 0)]
        public List<object> Items
        {
            get
            {
                return this.itemsField;
            }

            set
            {
                this.itemsField = value;
            }
        }

        /// <summary>
        /// Gets or sets a flag indicating if the list of items roles is ordered.
        /// </summary>
        [XmlAttribute("ordered")]
        public string Ordered
        {
            get
            {
                return this.orderedField;
            }

            set
            {
                this.orderedField = value;
            }
        }
    }
}